package org.vectrics.company;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import org.apache.log4j.Logger;
import org.vectrics.DataException;
import org.vectrics.SystemException;
import org.vectrics.client.webclient.CommandDispatcher;
import org.vectrics.common.cache.ObjectCache;
import org.vectrics.company.client.FindCompany;
import org.vectrics.company.client.FindCompanyIds;
import org.vectrics.domain.Domain;
import org.vectrics.employee.Employee;
import org.vectrics.employee.JobTermReference;
import org.vectrics.location.Address;
import org.vectrics.recruiter.job.JobTerm;
import org.vectrics.user.Person;
import org.vectrics.user.PersonPrivilegeGroup;
import org.vectrics.user.PersonPrivilegeGroupType;

/**
 * @author mmoore
 */
public class CompanyRemoteProvider implements CompanyService {
	static private transient Logger log = Logger.getLogger(CompanyRemoteProvider.class);
	private ObjectCache companyCache = new ObjectCache();

	public CompanyRemoteProvider() {
		super();
	}
	
	public Company findCompanyWithName(String name) {
		return(null);
	}
	
	public Sector findSector(String code) {
		return (null);
	}
	
	public Collection findAllSectors() {
		return(null);
	}

	
	/* (non-Javadoc)
	 * @see org.vectrics.company.CompanyService#findCompanyPersonGroup(org.vectrics.company.CompanyPerson, org.vectrics.company.CompanyPersonGroupType)
	 */
	public PersonPrivilegeGroup findCompanyPersonGroup(CompanyPerson companyPerson, PersonPrivilegeGroupType companyPersonGroupType) {
		return null;
	}

	public Set findCompanyPersonsForPerson(Person person) {
		return(null);
	}

	public CompanyPersonGroupType findCompanyGroupType(String code) {
		return(null);
	}
	
	
	/* (non-Javadoc)
	 * @see org.vectrics.company.CompanyService#updateCompanyPersonGroup(org.vectrics.company.CompanyPersonGroup)
	 */
	public void updateCompanyPersonGroup(PersonPrivilegeGroup companyPersonGroup) {
	}

	public PersonPrivilegeGroupType findCompanyPersonGroupType(String code) {
		return(null);
	}
	
	public Set findCompaniesForPerson(Person person) {
		return(null);
	}
	
	public Company createCompany(Domain domain, String companyName, Company parent, Sector sector) {
		return(null);
	}
	
	public Company createCompanyAndDomain(String companyName, Company parent, Domain domain, Sector sector) {
		return null;
	}
	
	public void removeCompany(Company company)  {
	}
	
	public void removeAll()  {
	}
	
	public CompanyPerson findCompanyPerson(Long companyPersonId) {
	    return(null);
	}

	public CompanyPerson findCompanyPerson(Company cmp, Person person) {
	    return(null);
	}
	
	public void updateCompanyPerson(CompanyPerson companyPerson) {
	}
	
	public void removeCompanyPerson(CompanyPerson companyPerson) {
	}
	
	public Collection findHiringManagers(Company company) {
		return(null);
	}
	
	
	public CompanyPersonRoleType findCompanyPersonRoleType(String code) {
	    return(null);
	}
	
	public Company findCompany(Long companyId)  {
		log.debug("findCompany() - method to find company with id");
		if (companyId == null)
			throw new DataException("findCompany(id) was passed a null id");
		FindCompany command = new FindCompany();
		Company company = (Company)companyCache.findObjectInCache(companyId);
		if (company == null) {
			command.setCompanyId(companyId);
			log.debug("Sending command to server to find company");
			CommandDispatcher.getInstance().execute(command);
			company = command.getCompany();
			companyCache.addToCache(company);
		}
		return(company);
	}

	public Company updateCompany(Company arg0)  {
		return null;
	}

	public Company findCompanyWithReferenceId(String arg0)  {
		return null;
	}

	public List loadCompaniesFromIds(List arg0)  {
		return null;
	}

	public List getAllCompanyIds()  {
		FindCompanyIds command = new FindCompanyIds();
		List companyIds = null;
		log.debug("sending command to command manager to retrieve all company id's");
		CommandDispatcher.getInstance().execute(command);
		companyIds = command.getCompanyIdList();
		return(companyIds);
	}

	public void removeCompanyAddress(Company arg0)  {
		throw new DataException("Not implemented");
	}

	public void setCompanyAddress(String arg0, Address arg1) {
		throw new DataException("Not implemented");
	}

	public void addCompanyPerson(CompanyPerson companyPerson) {
	}
	
	public List findCompanyUsers(Company company)  {
		log.debug("updateCompany()");
		List companyUsers = null;
		throw new DataException("Not implemented");
		// TODO
//		return(companyUsers);
	}
	
	public List findCompanyUsersForUser(Long personId)  {
		log.debug("updateCompany()");
		List companyUsers = null;
		// TODO
		throw new DataException("Not implemented");
		//return(companyUsers);
	}
	
	public CompanyPerson findCompanyPerson(Long companyId, Long userId) {
		CompanyPerson companyUser = null;
		throw new DataException("Not implemented");
		//return(companyUser);
	}
	
	public void removeCompanyUser(Long companyId, Long personId)  {
		throw new DataException("Not implemented");
	}
	
	public void saveCompanyUser(CompanyPerson companyUser)  {
		throw new DataException("Not implemented");
	}
	
	public int findCompanyCount(CompanySelectCriteria criteria)  {
		throw new DataException("Not implemented");
	}
	
	public List findCompanies(CompanySelectCriteria criteria, int startIndex, int endIndex)  {
		throw new DataException("Not implemented");
	}
	
	public int findCompanyPersonCount(Company company)  {
		throw new SystemException("Not implemented");
	}
	
	public List findCompanyPersons(Company company, int startIndex, int endIndex)  {
		throw new SystemException("Not implemented");
	}
	
	public void updateRecruiters(List<Employee> recruiters) {
	}

	public int findChildCompanyCount(Long parentId)  {
		int count = 0;
		return(count);
	}
	
	public List findChildCompanies(Long parentId, int startIndex, int endIndex)  {
		List list = null;
		return(list);
	}

	public int findParentCompanyCount()  {
		int count = 0;
		return(count);
	}
	
	public List findParentCompanies(int startIndex, int endIndex)  {
		List list = null;
		return(list);
	}
	
	public Set findCompaniesForDomains(Set domains) {
		return(null);
	}
	
	public int findCompanyPersonCount(CompanyPersonCriteria criteria) {
		return 0;
	}
	
	public List findCompanyPersons(CompanyPersonCriteria criteria, int startIndex, int endIndex) {
		return(null);	
	}
	
	public List findCompanyGroupTypes() {
		return(null);
	}

	public List findCompanyGroups(String code) {
		return null;
	}

	public void updateCompanyPersonGroup(CompanyPersonGroup companyPersonGroup) {
	}
	
	public void removeCompanyPersonGroup(CompanyPersonGroup companyPersonGroup) {
	}

	public CompanyPersonRole findCompanyPersonRole(Long id) {
		return(null);
	}

	public void updateCompanyPersonRole(CompanyPersonRole role) {
	}

	// Se implementan en el servicio CompanyPersistMgr
	public List<Employee> findAllEmployees() {
		return null;
	}

	public Employee findEmployeeForIdPerson(Long idPerson) {
		return null;
	}

	public List<Company> findAllCompany() {
		return null;
	}

	public Employee findEmployee(Long idPerson) {
		return null;
	}

	public Employee findEmployee(Long idPerson, Long idCompany) {
		return null;
	}

	public List<JobTerm> findStatusForPersonId(Long idPerson, Long idCompany) {
		// TODO Auto-generated method stub
		return null;
	}

	public JobTermReference findJobTermReference(JobTerm toJobTerm,
			JobTerm fromJobTerm) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
